package com.trkj.service.lzs;


import java.math.BigDecimal;
import java.sql.Timestamp;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.trkj.dao.lzs.SocialAccountDao;
import com.trkj.pojo.SocialAccount;
import com.trkj.pojo.SocialLeixing;
@Service
public class SocialAccountService {
	@Autowired 
	private  SocialAccountDao  socialAccountdao;
//社保账套
	//查询所有
		public  List<SocialAccount>  SocialLeixingfall(){
		   return (List<SocialAccount>) socialAccountdao.findAll();
			
		}
		//添加
		public void SocialAccountadd( Timestamp socialCretordate,String socialName, Timestamp socialEndate,BigDecimal socialNumber, String socialPerson,String socialRemark,
				Timestamp socialStaratdate,Timestamp socialUpdatedate) {
			try {
				SocialAccount ab= new SocialAccount();
				ab.setSocialCretordate(socialCretordate);
				ab.setSocialEndate(socialEndate);
				ab.setSocialName(socialName);
				ab.setSocialNumber(socialNumber);
				ab.setSocialPerson(socialPerson);
				ab.setSocialRemark(socialRemark);
				ab.setSocialUpdatedate(socialUpdatedate);
				ab.setSocialStaratdate(socialStaratdate);
				ab.getSocialSecurities();
				socialAccountdao.save(ab);
			} catch (Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			
		}
		
		//编辑  
	    public   void lzs_SocialAccountbj( long  socialId,Timestamp socialCretordate,String socialName, Timestamp socialEndate,BigDecimal socialNumber, String socialPerson,String socialRemark,
				Timestamp socialStaratdate,Timestamp socialUpdatedate) {
	    	SocialAccount edit =socialAccountdao.findOne(socialId);
	    	edit.setSocialCretordate(socialCretordate);
	    	edit.setSocialEndate(socialEndate);
	    	edit.setSocialName(socialName);
	    	edit.setSocialNumber(socialNumber);
	    	edit.setSocialPerson(socialPerson);
	    	edit.setSocialRemark(socialRemark);
	    	edit.setSocialUpdatedate(socialUpdatedate);
	    	edit.setSocialStaratdate(socialStaratdate);
			   	 
	    	socialAccountdao.save(edit);
	    }
	    public SocialAccount chun1(Long socialId) {
	   	 return socialAccountdao.findOne(socialId);
			
	    }
	    //模糊查询
	 	public  List<SocialAccount> queryByName (String  text){

				return socialAccountdao.queryByName("%" + text + "%");
			}
	 	//删除
		  public boolean dltRay(Long socialId) {
		 		if(socialAccountdao.exists(socialId)){
		 			socialAccountdao.delete(socialId);
		 			 return true;
		 		}
		 		return false;
		  }
}
